﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using AppiSynchro.Library.Helpers;

namespace AppiSynchro.Library
{
    public class ApplicationInfoLoader
    {
        public ApplicationInfoLoader()
        {

        }

        public List<IApplicationInfo> Load(String path)
        {
            List<IApplicationInfo> AIList = new List<IApplicationInfo>();

            string[] filePaths = Directory.GetFiles(path, "*.xml");

            foreach (String file in filePaths)
            {
                IApplicationInfo ia = ApplicationInfoHelper.LoadXml(file);

                if (ia != null)
                    AIList.Add(ia);
            }
            
            return AIList;
        }
    }
}
